(function(){function C(a,c,b){if(a.length==c)return b;a=a.substr(c);return/^[0-9]+$/.exec(a)?b+"["+a+"]":b+"."+a}function m(a,c){var b,d,e=E.exec(a);e?(d=[e[1]],a=e[2],b=Array(1)):(e=F.exec(a))?(d=e[1].split(/\s*,\s*/),a=e[2],b=Array(d.length)):b=Array(c);for(var i=0,g=b.length;i<g;++i)b[i]=0;e=a.match(D);if(d){i=0;for(g=e.length;i<g;++i)for(var f=e[i],l=0,j=d.length;l<j;++l)if(f==d[l]){++b[l];break}}else{i=0;for(g=e.length;i<g;++i)f=e[i],d=f.charAt(0),"$"==d?(j=f.length,2<=j&&"$"==f[1]?++b[1]:(1==
j||!(f in window))&&++b[0]):"@"==d?++b[b.length-1]:"#"==d&&(f=parseInt(f.substr(1)),++b[f])}return b}function j(a,c,b){var d,e=E.exec(a);if(e)d=[e[1]],a=e[2];else if(e=F.exec(a))d=e[1].split(/\s*,\s*/),a=e[2];var i=arguments,g=0<i.length?i[i.length-1]:"";return d?a.replace(D,function(a){for(var b=0,c=d.length;b<c;++b)if(a==d[b])return i[b+1];return a}):a.replace(D,function(a){var d=a.charAt(0);if("$"==d){d=a.length;if(2<=d&&"$"==a[1])return C(a,2,b);if(1==d||!(a in window))return C(a,1,c)}else{if("@"==
d)return C(a,1,g);if("#"==d)return i[parseInt(a.substr(1))+1]}return a})}function y(a,c){if(!a)return null;if("function"==typeof a)return a;var b,d=/^\s*(\w+)\s*=>(.+)$/.exec(a);if(d)b=[d[1]],a=d[2];else if(d=/^\s*\(\s*([\w\s,]*)\s*\)\s*=>(.+)$/.exec(a))b=d[1].split(/\s*,\s*/),a=d[2];if(!b){b=[];for(d=0;d<c;++d)b.push("$"+d);d=[a].concat(b);a=j.apply(null,d)}b.push("return "+a+";");return Function.apply(window,b)}function s(a){var c=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
b={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return c.test(a)?'"'+a.replace(c,function(a){var c=b[a];return c?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function w(a,c){var b=function(){};b.prototype=a.prototype;c.prototype=new b}function H(a,c){var b=a?a+"=":"";if("boolean"==typeof c)return b+(c?"1":"0");if("string"==typeof c)return b+encodeURIComponent(c);if("number"==typeof c)return b+c.toString();if("object"==typeof c){var d=[];
$from(c).each(function(b,c){c=encodeURIComponent(c);d.push(H(a?a+"["+c+"]":c,b))});return d.join("&")}return""}function z(a,c){this.$o=$from(this.o=[]);this.c=a;this.a=c}function A(){}function f(a){this.each=a}function n(a){this.str=a}function k(a){this.data=a}function t(a){this.data=a}function u(a){this.str=a}function v(a){this.data=a}function B(a){this.data=a}function x(a){this.iteratable=a;this.context=[]}var I=this.global&&this==global,E=/^\s*(\w+)\s*=>(.+)$/,F=/^\s*\(\s*([\w\s,]*)\s*\)\s*=>(.+)$/,
D=/"(?:[^"]|\\")*"|'(?:[^']|\\')*'|[\$@\w_#]+/g;z.prototype._getPrimitiveList=function(a,c){var b=this[a];b||(this[a]=b={});var c=c.toString(),d=b[c];d||(b[c]=d=[],this.o.push({k:c,l:d}));return d};z.prototype._getList=function(a){var c=this.c,b;if(c)b="string"==typeof c?j(c,"$k","@k","@a"):"@c($k,@k,@a)";else{switch(typeof a){case "string":return this._getPrimitiveList("s",a);case "number":return this._getPrimitiveList("n",a);case "boolean":return this._getPrimitiveList("b",a)}b="$k==@k"}if(c=this.$o.first(b,
{k:a,c:c,a:this.a}))return c.l;c=[];this.o.push({k:a,l:c});return c};z.prototype.add=function(a,c){this._getList(a).push(c)};z.prototype.$each=function(a,c){this.broken=!this.$o.selectPair("$from($l)","$k").each(a,c).broken;return this};A.prototype.getBucket=function(a){var c=this.cache;if(!c){this.cache=c={};var b=this;setTimeout(function(){b.cache=null},0)}var d=c[a];d||(c[a]=d={});return d};A.prototype.get=function(a,c){return this.getBucket(a)[c]};A.prototype.set=function(a,c,b){this.getBucket(a)[c]=
b};var h=new A;this.jQuery&&(f.prototype.jQuery=function(){return jQuery(this.toArray())});f.prototype.broken=!1;f.prototype.where=function(a,c){var b;"string"==typeof a?(b=h.get("($_$$_a0)",a),b||(b="("+j(a,"$","$$","@a0")+")",h.set("($_$$_a0)",a,b))):b="@pr($,$$,@a0)";var d=this;return new f(function(e,i){var g;"string"==typeof e?(g=h.get("($_$$_a)",e),g||(g="("+j(e,"$","$$","@a")+")",h.set("($_$$_a)",e,g))):g="@p($,$$,@a)";this.broken=d.each(b+"?"+g+":0",{p:e,pr:a,a0:c,a:i}).broken;return this})};
f.prototype.aggregate=function(a,c){var b;"string"==typeof a?(b=h.get("(c_$_$$_a)",a),b||(b="("+j(a,"@c","$","$$","@a")+")",h.set("(c_$_$$_a)",a,b))):b="@p(@c,$,$$,@a)";var d={p:a,f:!0,a:c};this.each("@f?(@f=false,@c=$,0):(@c="+b+",0)",d);return d.c};f.prototype.aggregateSeed=function(a,c,b){var d;"string"==typeof c?(d=h.get("(c_$_$$_a)",c),d||(d="("+j(c,"@c","$","$$","@a")+")",h.set("(c_$_$$_a)",c,d))):d="@p(@c,$,$$,@a)";a={c:a,a:b,p:c};this.each("(@c="+d+"),0",a);return a.c};f.prototype.all=function(a,
c){var b;"string"==typeof a?(b=h.get("($_$$_a)",a),b||(b="("+j(a,"$","$$","@a")+")",h.set("($_$$_a)",a,b))):b="@p($,$$,@a)";return!this.each("!"+b+"?false:0",{a:c,p:a}).broken};f.prototype.any=function(a,c){var b;a?"string"==typeof a?(b=h.get("($_$$_a)",a),b||(b="("+j(a,"$","$$","@a")+")",h.set("($_$$_a)",a,b))):b="@p($,$$,@a)":b="true";return this.each(b+"?false:0",{a:c,p:a}).broken};f.prototype.at=function(a){return this.skip(a).first()};f.prototype.atOrDefault=function(a,c){var b=this.at(a);return void 0==
b?c:b};f.prototype.average=function(){var a={f:!0};this.each("@f?(@f=false,@s=$,@c=1,0):(@s+=$,++@c)",a);return a.s/a.c};f.prototype.concat=function(a){var c=this;return new f(function(b,d){this.broken=!1;if(c.each(b,d).broken||a.each(b,d).broken)return this.broken=!0,this})};f.prototype.contains=function(a,c,b){var d;c?"string"==typeof c?(d=h.get("(v_$_a)",c),d||(d="("+j(c,"@v","$","@a")+")",h.set("(v_$_a)",c,d))):d="@c(@v,$,@a)":d="$==@v";a={v:a,a:b,c:c,r:!1};this.each(d+"?((@r=true),false):0",
a);return a.r};f.prototype.count=function(a,c){var b;a?"string"==typeof a?(b=h.get("($_$$_a)",a),b||(b="("+j(a,"$","$$","@a")+")",h.set("($_$$_a)",a,b))):b="@p($,$$,@a)":b="true";var d={a:c,p:a,c:0};this.each(b+"?++@c:0",d);return d.c};f.prototype.defaultIfEmpty=function(a){var c=this;return new f(function(b,d){c.each("false").broken?this.broken=c.each(b,d).broken:(typeof("string"==b)&&(b=y(b,3)),this.broken=!1===b(a,0,d));return this})};f.prototype.distinct=function(a){var c=a?",@c,@a":"",b=[],d=
$from(b),e=this;return new f(function(i,g){var f;"string"==typeof i?(f=h.get("($_$$_a0)",i),f||(f="("+j(i,"$","$$","@a0")+")",h.set("($_$$_a0)",i,f))):f="@p($,$$,@a0)";this.broken=e.each("!@ll.contains($"+c+")?(@l.push($),"+f+"):0",{c:a,ll:d,l:b,p:i,a0:g}).broken;return this})};f.prototype.except=function(a,c,b){var d;d=c?",@c,@a0":"";var e=this;return new f(function(i,g){this.broken="string"==typeof i?e.each("@s.contains($"+d+")?0:("+j(i,"$","$$","@a")+")",{c:c,a0:b,s:$from(a),a:g}).broken:e.each("@s.contains($"+
d+")?0:@p($,$$,@a)",{c:c,a0:b,p:i,s:$from(a),a:g}).broken;return this})};f.prototype.first=function(a,c){if(a)"string"==typeof a?(b={a:c},this.each("("+j(a,"$","$$","@a")+")?(@r=$,false):0",b)):(b={a:c,p:a},this.each("@p($,$$,@a)?(@r=$,false):0",b));else{var b={};this.each("(@r=$),false",b)}return b.r};f.prototype.firstOrDefault=function(a,c,b){var d=1>=arguments.length?this.first():this.first(a,b);return void 0==d?c:d};f.prototype.groupBy=function(a,c,b){return this.groupBy2("$",a,c,b)};f.prototype.groupBy2=
function(a,c,b,d){return this._getGroupIteratable(a,c,b,d)};f.prototype.groupBy3=function(a,c,b,d){return this.groupBy4("$",a,c,b,d)};f.prototype.groupBy4=function(a,c,b,d,e){var i;i="string"==typeof b?j(b,"$","$$","@a"):"@rs($,$$,@a)";return this._getGroupIteratable(a,c,d,e).selectPair(i,"$$",{rs:b,a:e})};f.prototype._getGroupIteratable=function(a,c,b,d){var b=new z(b,d),e=$from(b),i;i="string"==typeof c?"("+j(c,"$","$$","@a")+")":"@ks($,$$,@a)";var g;g="string"==typeof a?"("+j(a,"$","$$","@a")+
")":"@vs($,$$,@a)";this.each("(@k="+i+"),(@v="+g+"),@g.add(@k,@v),0",{ks:c,vs:a,g:b,a:d});return e};f.prototype.groupJoin=function(a,c,b,d,e,i){a=$from(a);c="string"==typeof c?"("+j(c,"$","$$","@a")+")":"@oks($,$$,@a)";b="string"==typeof b?"("+j(b,"$","$$","@a")+")":"@iks($,$$,@a)";b=e?"string"==typeof e?j(e,"@ok",b):"@c(@ok,"+b+")":"@ok=="+b;b=s(b);c="@i.where("+b+",{a:@a,ok:"+c+",c:@c})";if("string"==typeof d)switch(m(d,3)[1]){case 0:case 1:c=j(d,"$",c,"@a");break;default:c="(@w="+c+"),("+j(d,"$",
"@w","@a")+")"}else c="@rs($,"+c+",@a)";return this.select(c,{rs:d,i:a,a:i,c:e})};f.prototype.intersect=function(a,c,b){var d;d=c?"string"==typeof c?s(c):"@c":"null";return this.where("@t.contains($,"+d+",@a)",{t:$from(a),a:b,c:c})};f.prototype.join=function(a,c,b,d,e,i){var a=$from(a),g;g="string"==typeof c?"("+j(c,"$","$$","@a")+")":"@oks($,$$,@a)";var p;p="string"==typeof b?"("+j(b,"$","$$","@a")+")":"@iks($,$$,@a)";var l;l=e?"string"==typeof e?j(e,"@ok",p):"@c(@ok,"+p+")":"@ok=="+p;l=s(l);var h;
h="string"==typeof d?"("+j(d,"@ov","$","@a")+")":"@rs(@ov,$,@a)";var q=this;return new f(function(e,f){var p;if("string"==typeof e){var k=m(e,3);p=[];var n;switch(k[0]){case 0:case 1:n=h;break;default:p.push("(@RS="+h+")"),n="@RS"}switch(k[1]){case 0:case 1:k="(@c++)";break;default:p.push("(@cc=@c++)"),k="@cc"}p.push("("+j(e,n,k,"@a0")+")");p=p.join(",")}else p="@p("+h+",@c++,@a0)";this.broken=q.each("(@ok="+g+"),(@ov=$),@i.where("+l+",@).each("+s(p)+",@)",{i:a,oks:c,iks:b,rs:d,p:e,a:i,a0:f,c:0}).broken;
return this})};f.prototype.last=function(a,c){if(a)"string"==typeof a?(b={a:c},this.each("("+j(a,"$","$$","@a")+")?@r=$:0",b)):(b={a:c,p:a},this.each("@p($,$$,@a)?@r=$:0",b));else{var b={};this.each("@r=$",b)}return b.r};f.prototype.lastOrDefault=function(a,c,b){var d=1>=arguments.length?this.last():this.last(a,b);return void 0==d?c:d};f.prototype.max=function(a,c){if(!a)return this.aggregate("#0>#1?#0:#1");var b;b="string"==typeof a?"("+j(a,"$","$$","@a")+")":"@s($,$$,@a)";var d={f:!0,s:a,a:c};this.each("@f?((@f=false),(@r=$),(@m="+
b+"),0):((@v="+b+"),(@v>@m?((@m=@v),(@r=$)):0),0)",d);return d.r};f.prototype.min=function(a,c){if(!a)return this.aggregate("#0<#1?#0:#1");var b;b="string"==typeof a?"("+j(a,"$","$$","@a")+")":"@s($,$$,@a)";var d={f:!0,s:a,a:c};this.each("@f?((@f=false),(@r=$),(@m="+b+"),0):((@v="+b+"),(@v<@m?((@m=@v),(@r=$)):0),0)",d);return d.r};f.prototype.orderBy=function(a,c,b){var d=new x(this);d._addContext(a||"$",c,!1,b);return d};f.prototype.orderByDesc=function(a,c,b){var d=new x(this);d._addContext(a||
"$",c,!0,b);return d};f.prototype.reverse=function(){var a=this;return new f(function(c,b){var d=[];a.each("@push($$),@push($),0",d);if("string"==typeof c){var e=m(c,3),i,g,f;switch(e[0]){case 0:case 1:i="";g="l[(i-1)*2+1]";break;default:i="var v=l[(i-1)*2+1];",g="v"}switch(e[1]){case 0:case 1:e="";f="l[(i-1)*2]";break;default:e="var k=l[(i-1)*2];",f="k"}this.broken=(new Function("l","a","for(var i=l.length/2;i>0;--i){"+e+i+"if(("+j(c,g,f,"a")+")===false){return true;}}return false;"))(d,b)}else{this.broken=
!1;for(i=d.length/2;0<i;--i)if(!1===c(d[2*(i-1)+1],d[2*(i-1)],b)){this.broken=!0;break}}return this})};f.prototype.select=function(a,c){var b=this,d;"string"==typeof a?(d=h.get("($_$$_a0)",a),d||(d="("+j(a,"$","$$","@a0")+")",h.set("($_$$_a0)",a,d))):d="@s($,$$,@a0)";return new f(function(e,i){if("string"==typeof e){var g=m(e,3),f=[],l;switch(g[0]){case 0:l="";break;case 1:l=d;break;default:f.push("(@v="+d+")"),l="@v"}switch(g[1]){case 0:g="";break;case 1:g="(@i++)";break;default:f.push("(@j=@i++)"),
g="@j"}f.push(j(e,l,g,"@a"));this.broken=b.each(f.join(","),{s:a,a0:c,a:i,i:0}).broken}else this.broken=b.each("@p("+d+",@i++,@a)",{s:a,a0:c,a:i,i:0,p:e}).broken;return this})};f.prototype.selectMany=function(a,c){var b;b="string"==typeof a?j(a,"$","$$","@a"):"@s($,$$,@a)";var d=this;return new f(function(e,i){var g;if("string"==typeof e)switch(m(e,3)[1]){case 0:case 1:g=j(e,"$","(@i++)","@a0");break;default:g="(@j=@i++),("+j(e,"$","@j","@a0")+")"}else g="@p($,@i++,@a0)";this.broken=d.each("$from("+
b+").each("+s(g)+",@)",{s:a,a:c,a0:i,i:0,p:e});return this})};f.prototype.selectPair=function(a,c,b){var d=this,e,i;"string"==typeof a?(e=h.get("($_$$_a0)",a),e||(e="("+j(a,"$","$$","@a0")+")",h.set("($_$$_a0)",a,e))):e="@vs($,$$,@a0)";"string"==typeof c?(i=h.get("($_$$_a0)",c),i||(i="("+j(c,"$","$$","@a0")+")",h.set("($_$$_a0)",c,i))):i="@ks($,$$,@a0)";return new f(function(g,f){var l;if("string"==typeof g){var h=m(g,3),q=[];switch(h[0]){case 0:case 1:l=e;break;default:q.push("(@VS="+e+")"),l="@VS"}switch(h[1]){case 0:case 1:h=
i;break;default:q.push("(@KS="+i+")"),h="@KS"}q.push(j(g,l,h,"@a"));l=q.join(",")}else l="@p("+e+","+i+",@a)";this.broken=d.each(l,{a0:b,a:f,p:g,vs:a,ks:c}).broken;return this})};f.prototype.sequenceEqual=function(a,c,b){var d;d=c?"string"==typeof c?j(c,"#0","#1","@a"):"@c(#0,#1,@a)":"#0==#1";return this.zip(a,d,{a:b,c:c}).all("$==true")};f.prototype.single=function(a){a=!a?this.take(2):this.where(a).take(2);if(1==a.count())return a.first()};f.prototype.singleOrDefault=function(a,c,b){var d;1>=arguments.length?
(d=this.take(2),c=a):d=this.where(a).take(2);var e=d.count();if(0==e)return c;if(1==e)return d.first();throw Error("The sequence has more than one element satisfying the condition.");};f.prototype.skip=function(a){var c=this;return new f(function(b,d){var e;"string"==typeof b?(e=h.get("($_$$_a)",b),e||(e="("+j(b,"$","$$","@a")+")",h.set("($_$$_a)",b,e))):e="@p($,$$,@a)";this.broken=c.each("@c==0?"+e+":--@c",{p:b,a:d,c:a}).broken;return this})};f.prototype.skipWhile=function(a,c){var b;"string"==typeof a?
(b=h.get("($_$$_a)",a),b||(b="("+j(a,"$","$$","@a")+")",h.set("($_$$_a)",a,b))):b="@pr($,$$,@a)";var d=this;return new f(function(e,i){var g;"string"==typeof e?(g=h.get("($_$$_a0)",e),g||(g="("+j(e,"$","$$","@a0")+")",h.set("($_$$_a0)",e,g))):g="@p($,$$,@a0)";this.broken=d.each("@f||(@f=!"+b+")?"+g+":0",{pr:a,f:!1,a:c,a0:i}).broken;return this})};f.prototype.sum=function(){return this.aggregate("#0+#1")};f.prototype.take=function(a){var c=this;return new f(function(b,d){var e;"string"==typeof b?(e=
h.get("($_$$_a)",b),e||(e="("+j(b,"$","$$","@a")+")",h.set("($_$$_a)",b,e))):e="@p($,$$,@a)";var i={i:0,p:b,a:d,b:!1};this.broken=c.each("(@i++<"+a+")?"+e+":(@b=true,false)",i).broken&&!i.b;return this})};f.prototype.takeWhile=function(a,c){var b;"string"==typeof a?(b=h.get("($_$$_a)",a),b||(b="("+j(a,"$","$$","@a")+")",h.set("($_$$_a)",a,b))):b="@pr($,$$,@a)";var d=this;return new f(function(e,i){var g;"string"==typeof e?(g=h.get("($_$$_a0)",e),g||(g="("+j(e,"$","$$","@a0")+")",h.set("($_$$_a0)",
e,g))):g="@p($,$$,@a0)";var f={p:e,pr:a,a:c,a0:i,b:!1};this.broken=d.each(b+"?"+g+":(@b=true,false)",f).broken&&!f.b;return this})};f.prototype.toArray=function(){var a=[];this.each("@push($)",a);return a};f.prototype.toDictionary=function(){var a={};this.each("@[$$]=$",a);return a};f.prototype.toJSON=function(a){function c(d){var e=typeof d;return"string"==e?s(d):"number"==e||"boolean"==e?d.toString():"function"==e?c(d()):b.contains(d)||(d instanceof k||d instanceof t)&&b.contains(d.data)?"null":
$from(d).toJSON(a)}a||(a=[]);var b=$from(a),d="number"==typeof this.select("$$").first();a.push(this);if(d){var e=[];this.each(function(a){e.push(c(a))});d="["+e.join(", ")+"]"}else e=[],this.each(function(a,b){e.push(s(b.toString())+": "+c(a))}),d="{"+e.join(", ")+"}";a.pop(this);return d};f.prototype.toString=function(a){return a?this.aggregate("#0+"+s(a)+"+#1"):this.aggregate("#0+#1")};f.prototype.toURLEncoded=function(){return H(null,this)};f.prototype.union=function(a,c,b){var d=[],e=$from(d),
i=this;return new f(function(f,h){var l;if("string"==typeof f)switch(m(f,3)[1]){case 0:case 1:l=j(f,"$","(@b.length-1)","@a0");break;default:l="(@bb=@b.length-1),("+j(f,"$","@bb","@a0")+")"}else l="@p($,@b.length-1,@a0)";l="@bi.contains($,@c,@a)?0:(@b.push($),"+l+",0)";var G={c:c,b:d,bi:e,a0:h,a:b};if(i.each(l,G).broken)return this.broken=!0,this;$from(a).each(l,G).broken&&(this.broken=!0);return this})};f.prototype.zip=function(a,c,b){var d;if("string"==typeof c){var e=m(c,5),i,g=[];switch(e[0]){case 0:case 1:i=
"@d[@i*2+1]";break;default:g.push("(@V=@d[@i*2+1])"),i="@V"}switch(e[2]){case 0:case 1:e="@d[@i*2]";break;default:g.push("(@K=@d[@i*2])"),e="@K"}g.push(j(c,i,"$",e,"$$","@a"));d="("+g.join(",")+")"}else d="@rs(@d[@i*2+1],$,@d[@i*2],$$,@a)";var h=this;return new f(function(e,i){var f=[];h.each("@push($$),@push($),0",f);var g;if("string"==typeof e){var r=m(e,3),k=[];switch(r[0]){case 0:case 1:g=d;break;default:k.push("(@RS="+d+")"),g="@RS"}switch(r[1]){case 0:case 1:r="(@k++)";break;default:k.push("(@kk=@k++)"),
r="@kk"}k.push(j(e,g,r,"@a0"));g="("+k.join(",")+")"}else g="@p("+d+",@k++,@a0)";this.broken=$from(a).each("@i>="+f.length/2+"?false:@r="+g+",++@i,@r",{a:b,a0:i,k:0,i:0,d:f,p:e,rs:c}).broken;return this})};f.prototype._formRequest=I?function(){throw Error("Not supported.");}:function(a,c,b){function d(a,b){if("boolean"==typeof b){var c=document.createElement("input");c.type="hidden";c.name=a;c.value=b?"1":"0";e.push(c)}else if("string"==typeof b||"number"==typeof b)c=document.createElement("input"),
c.type="hidden",c.name=a,c.value=b.toString(),e.push(c);else if("object"==typeof b){if(c=1==b.nodeType)c=$from(["input","select","textarea"]).contains(b.tagName.toLowerCase());c?(b.name=a,e.push(b)):$from(b).each(function(b,c){d(a?a+"["+c+"]":c,b)})}}var e=[];d(null,this);var i=$from(e),f;i.each(function(a){var b=a.parentNode;if(b){for(var c=[];;){c.push(b);if(b==a.ownerDocument.body||null==b)break;b=b.parentNode}f=f?$from(f).intersect(c).toArray():c}});var j;f&&0<f.length&&(j=f[0]);var h=document.createElement("form");
i.each(function(a){a.parentNode||h.appendChild(a)});if(j)if(j==document.body){for(i=document.body;j=i.firstChild;)h.appendChild(j);i.appendChild(h)}else j.parentNode.insertBefore(h,j),h.appendChild(j);else document.body.appendChild(h);h.method=a;h.action=c;b&&(h.enctype=b);h.submit()};f.prototype.submit=function(a,c){this._formRequest("POST",a,c)};f.prototype.redirect=function(a,c){this._formRequest("GET",a,c)};w(f,n);n.prototype.each=function(a,c){var b=this.str;if("function"==typeof a){this.broken=
!1;for(var d=0,e=b.length;d<e;++d)if(!1===a(b.charAt(d),d,c)){this.broken=!0;break}}else{d=h.get("each_s",a);if(!d){switch(m(a,3)[0]){case 0:case 1:d="";e="s.charAt(i)";break;default:d="var v=s.charAt(i);",e="v"}d=new Function("s","a","for(var i=0,c=s.length;i<c;++i){"+d+"if(("+j(a,e,"i","a")+")===false){return true;}}return false;");h.set("each_s",a,d)}this.broken=d(b,c)}return this};n.prototype.at=function(a){return this.str.charAt(a)};n.prototype.count=function(a,c){return a?f.prototype.count.call(this,
a,c):this.str.length};n.prototype.first=function(a,c){var b=this.str;if(a)return f.prototype.first.call(this,a,c);if(0<b.length)return b.charAt(0)};n.prototype.last=function(a,c){var b=this.str;if(a)return this.reverse().first(a,c);var d=b.length;if(0<d)return b.charAt(d-1)};n.prototype.reverse=function(){return new u(this.str)};n.prototype.toJSON=function(){return s(this.str)};n.prototype.zip=function(a,c,b){var d;if("string"==typeof c){var e,i=[];switch(m(c,5)[0]){case 0:case 1:e="@d.charAt(@i)";
break;default:i.push("(@V=@d.charAt(@i))"),e="@V"}i.push("("+j(c,e,"$","@i","$$","@a")+")");d="("+i.join(",")+")"}else d="@rs(@d.charAt(@i),$,@i,$$,@a)";var g=this;return new f(function(e,f){var i=g.str,h;if("string"==typeof e){var k=m(e,3),r=[];switch(k[0]){case 0:case 1:h=d;break;default:r.push("(@RS="+d+")"),h="@RS"}switch(k[1]){case 0:case 1:k="(@k++)";break;default:r.push("(@kk=@k++)"),k="@kk"}r.push(j(e,h,k,"@a0"));h="("+r.join(",")+")"}else h="@p("+d+",@k++,@a0)";this.broken=$from(a).each("@i>="+
i.length+"?false:@r="+h+",++@i,@r",{a:b,a0:f,k:0,i:0,d:i,p:e,rs:c}).broken;return this})};w(f,k);k.prototype.each=function(a,c){var b=this.data;if("function"==typeof a){this.broken=!1;for(var d=0,e=b.length;d<e;++d)if(!1===a(b[d],d,c)){this.broken=!0;break}}else{d=h.get("each_a",a);if(!d){switch(m(a,3)[0]){case 0:case 1:d="";e="d[i]";break;default:d="var v=d[i];",e="v"}d=new Function("d","a","for(var i=0,c=d.length;i<c;++i){"+d+"if(("+j(a,e,"i","a")+")===false){return true;}}return false;");h.set("each_a",
a,d)}this.broken=d(b,c)}return this};k.prototype.at=function(a){return this.data[a]};k.prototype.count=function(a,c){return a?f.prototype.count.call(this,a,c):this.data.length};k.prototype.first=function(a,c){if(a)return f.prototype.first.call(this,a,c);var b=this.data;if(0<b.length)return b[0]};k.prototype.last=function(a,c){if(a)return this.reverse().first(a,c);var b=this.data;if(0<b.length)return b[b.length-1]};k.prototype.reverse=function(){return new v(this.data)};k.prototype.toJSON=function(a){a?
a.push(this.data):a=[this.data];var c=f.prototype.toJSON.call(this,a);a.pop();return c};k.prototype.zip=function(a,c,b){var d;if("string"==typeof c){var e,i=[];switch(m(c,5)[0]){case 0:case 1:e="@d[@i]";break;default:i.push("(@V=@d[@i])"),e="@V"}i.push("("+j(c,e,"$","@i","$$","@a")+")");d="("+i.join(",")+")"}else d="@rs(@d[@i],$,@i,$$,@a)";var g=this;return new f(function(e,f){var i=g.data,h;if("string"==typeof e){var k=m(e,3),r=[];switch(k[0]){case 0:case 1:h=d;break;default:r.push("(@RS="+d+")"),
h="@RS"}switch(k[1]){case 0:case 1:k="(@k++)";break;default:r.push("(@kk=@k++)"),k="@kk"}r.push(j(e,h,k,"@a0"));h="("+r.join(",")+")"}else h="@p("+d+",@k++,@a0)";this.broken=$from(a).each("@i>="+i.length+"?false:@r="+h+",++@i,@r",{a:b,a0:f,k:0,i:0,d:i,p:e,rs:c}).broken;return this})};w(f,t);t.prototype.each=function(a,c){var b=this.data;if("function"==typeof a){this.broken=!1;for(var d in b)if(!1===a(b[d],d,c)){this.broken=!0;break}}else{d=h.get("each_o",a);if(!d){var e;switch(m(a,3)[0]){case 0:case 1:d=
"";e="d[k]";break;default:d="var v=d[k];",e="v"}d=new Function("d","a","for(var k in d){"+d+"if(("+j(a,e,"k","a")+")===false){return true;}}return false;");h.set("each_o",a,d)}this.broken=d(b,c)}return this};t.prototype.at=function(a){return this.skip(a).first()};t.prototype.reverse=function(){return new B(this.data)};t.prototype.toJSON=k.prototype.toJSON;w(n,u);u.prototype.each=function(a,c){var b=this.str;if("function"==typeof a){this.broken=!1;for(var d=b.length,e=d;0<e;--e)if(!1===a(b.charAt(e),
d-e,c)){this.broken=!0;break}}else{d=h.get("each_sr",a);if(!d){var f=m(a,3),g;switch(f[0]){case 0:case 1:d="";e="s.charAt(i-1)";break;default:d="var v=s.charAt(i-1);",e="v"}switch(f[1]){case 0:case 1:f="";g="(c-i)";break;default:f="var k=c-i;",g="k"}d=new Function("s","a","for(var i="+b.length+";i>0;--i){"+d+f+"if(("+j(a,e,g,"a")+")===false){return true;}}return false;");cache3.set("each_sr",a,d)}this.broken=d(b,c)}return this};u.prototype.at=function(a){var c=this.str;return c.charAt(c.length-a-
1)};u.prototype.first=function(a,c){var b=this.str;if(a)return f.prototype.first.call(this,a,c);if(0<b.length)return b.charAt(b.length-1)};u.prototype.last=function(a,c){var b=this.str;if(a)return this.reverse().first(a,c);if(0<b.length)return b.charAt(0)};u.prototype.reverse=function(){return new n(this.str)};n.prototype.toJSON=function(){return s(this.toString())};u.prototype.zip=function(a,c,b){var d=this.str,e=d.length,i;if("string"==typeof c){var g,h=[];switch(m(c,5)[0]){case 0:case 1:g="@d.charAt("+
e+"-@i-1)";break;default:h.push("(@V=@d.charAt("+e+"-@i-1))"),g="@V"}h.push("("+j(c,g,"$","@i","$$","@a")+")");i="("+h.join(",")+")"}else i="@rs(@d.charAt("+e+"-@i-1],$,@i,$$,@a)";return new f(function(f,g){var h;if("string"==typeof f){var k=m(f,3),p=[];switch(k[0]){case 0:case 1:h=i;break;default:p.push("(@RS="+i+")"),h="@RS"}switch(k[1]){case 0:case 1:k="(@k++)";break;default:p.push("(@kk=@k++)"),k="@kk"}p.push(j(f,h,k,"@a0"));h="("+p.join(",")+")"}else h="@p("+i+",@k++,@a0)";this.broken=$from(a).each("@i>="+
e+"?false:@r="+h+",++@i,@r",{a:b,a0:g,k:0,i:0,d:d,p:f,rs:c}).broken;return this})};w(k,v);v.prototype.each=function(a,c){var b=this.data;if("function"==typeof a){this.broken=!1;for(var d=b.length,e=d;0<e;--e)if(!1===a(b[e],d-e,c)){this.broken=!0;break}}else{d=h.get("each_ar",a);if(!d){var f=m(a,3),g;switch(f[0]){case 0:case 1:d="";e="d[i-1]";break;default:d="var v=d[i-1];",e="v"}switch(f[1]){case 0:case 1:f="";g="(c-i)";break;default:f="var k=c-i;",g="k"}d=new Function("d","a","for(var i="+b.length+
";i>0;--i){"+d+f+"if(("+j(a,e,g,"a")+")===false){return true;}}return false;");h.set("each_ar",a,d)}this.broken=d(b,c)}return this};v.prototype.at=function(a){var c=this.data;return c[c.length-a-1]};v.prototype.first=function(a,c){if(a)return f.prototype.first.call(this,a,c);var b=this.data;if(0<b.length)return b[b.length-1]};v.prototype.last=function(a,c){if(a)return this.reverse().first(a,c);var b=this.data;if(0<b.length)return b[0]};v.prototype.reverse=function(){return new k(this.data)};v.prototype.zip=
function(a,c,b){var d=this;return new f(function(e,f){var g=d.data,h=g.length,l;if("string"==typeof c){var k=m(c,5),q=[];switch(k[0]){case 0:case 1:l="@d["+h+"-@i-1]";break;default:q.push("(@V=@d["+h+"-@i-1])"),l="@V"}q.push("("+j(c,l,"$","@i","$$","@a")+")");l="("+q.join(",")+")"}else l="@rs(@d["+h+"-@i-1],$,@i,$$,@a)";if("string"==typeof e){k=m(e,3);q=[];switch(k[0]){case 0:case 1:break;default:q.push("(@RS="+l+")"),l="@RS"}switch(k[1]){case 0:case 1:k="(@k++)";break;default:q.push("(@kk=@k++)"),
k="@kk"}q.push(j(e,l,k,"@a0"));q="("+q.join(",")+")"}else q="@p("+l+",@k++,@a0)";this.broken=$from(a).each("@i>="+h+"?false:@r="+q+",++@i,@r",{a:b,a0:f,k:0,i:0,d:g,p:e,rs:c}).broken;return this})};w(t,B);B.prototype.each=function(a,c){var b=this.data,d=[],e;for(e in b)d.push(e),d.push(b[e]);if("string"==typeof a){b=h.get("each_or",a);if(!b){var f=m(a,3),g;switch(f[0]){case 0:case 1:b="";e="r[ii+1]";break;default:b="var v=r[ii+1];",e="v"}switch(f[1]){case 0:case 1:f="";g="r[ii]";break;default:f="var k=r[ii];",
g="k"}b=new Function("r","a","for(var i=r.length/2;i>0;--i){var ii=(i-1)*2;"+b+f+"if(("+j(a,e,g,"a")+")===false){return true;}}return false;");h.set("each_or",a,b)}this.broken=b(d,c)}else{this.broken=!1;for(b=d.length/2;0<b;--b)if(e=2*(b-1),!1===a(d[e+1],d[e],c)){this.broken=!0;break}}return this};B.prototype.reverse=function(){return new t(this.data)};w(t,x);x.prototype._addContext=function(a,c,b,d){this.context.push({keySelector:y(a,3),comparer:y(c,3),desc:b,arg:d})};x.prototype.each=function(a,
c){function b(a,b){for(var c=0,e=f.length;c<e;++c){var g=f[c],h=g.keySelector(d[2*a+1],d[2*a],g.arg),j=g.keySelector(d[2*b+1],d[2*b],g.arg),h=g.comparer?g.comparer(h,j,g.arg):h==j?0:h<j?-1:1;if(0!=h)return(g.desc?-1:1)*h}return 0}var d=[];this.iteratable.each("@push($$),@push($),0",d);var e=$range(d.length/2).toArray(),f=this.context;e.sort(b);if("string"==typeof a){b=h.get("each_ord",a);if(!b){var g=m(a,3),k,l,n;switch(g[0]){case 0:case 1:k="";l="r[n+1]";break;default:k="var v=r[n+1];",l="v"}switch(g[1]){case 0:case 1:g=
"";n="r[n]";break;default:g="var k=r[n];",n="k"}b=new Function("l","r","a","for(var i=0;i<"+e.length+";++i){var n=l[i]*2;"+k+g+"if(("+j(a,l,n,"a")+")===false)return true;}return false;");h.set("each_ord",a,b)}this.broken=b(e,d,c)}else{this.broken=!1;k=0;for(l=e.length;k<l;++k)if(g=2*e[k],!1===a(d[g+1],d[g],c)){this.broken=!0;break}}return this};x.prototype.thenBy=function(a,c,b){this._addContext(a,c,!1,b);return this};x.prototype.thenByDesc=function(a,c,b){this._addContext(a,c,!0,b);return this};
this.$from=function(a){return a instanceof f?a:a.$each?new f(function(c,b){this.broken=!1===a.$each(c,b);return this}):"string"==typeof a?new n(a):a instanceof Array?new k(a):new t(a)};this.$empty=function(){return new f(function(){return this})};this.$range=function(a,c,b){switch(arguments.length){case 1:c=a;a=0;b=1;break;case 2:b=c>a?1:-1}return new f(function(d,e){if("string"==typeof d){var f=0<b?"each_ru":"each_rd",g=h.get(f,d);g||(g=new Function("s","e","st","a","for(var i=s;i"+(0<b?"<":">")+
"e;i+=st){if(("+j(d,"i","i","a")+")===false)return true;}return false;"),h.set(f,d,g));this.broken=g(a,c,b,e)}else if(this.broken=!1,0<b)for(f=a;f<c;f+=b){if(!1===d(f,f,e)){this.broken=!0;break}}else for(f=a;f>c;f+=b)if(!1===d(f,f,e)){this.broken=!0;break}return this})};this.$repeat=function(a,c){return new f(function(b,d){if("string"==typeof b){var e=h.get("each_rpt",b);e||(e=new Function("c","e","a","for(var i=0;i<c;++i){if(("+j(b,"e","i","a")+")===false)return true;}return false;"),h.set("each_rpt",
b,e));this.broken=e(c,a,d)}else{this.broken=!1;for(e=0;e<c;++e)if(!1===b(a,e,d)){this.broken=!0;break}}return this})};this.jQuery&&(jQuery.fn.from=function(){var a=this;return new f(function(c,b){var c=y(c,3),d;a.each(function(a){return d=c(this,a,b)});this.broken=!1===d;return this})});var J={replace:j,parse:y,getHint:m};I?exports.Lambda=J:(window.js||(js={}),js.from||(js.from={}),js.from.Lambda=J)})();
